home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / tcoop10a.zip / DOC.ZIP / GRAPHIC.DOC < prev    next >
Text File  |  1991-11-20  |  7KB  |  186 lines

  1. GRAPHIC.DOC     11/15/91        Copyright (c) 1991 by James S. Clark
  2. ==========================================================================
  3. GRAPHIC
  4. Graphic Class
  5. --------------------------------------------------------------------------
  6. Class Name                      Graphic
  7. Superclass                      <none>
  8. Category                        Graphics
  9. Other classes referenced        <none>
  10. Other catagories referenced     <none>
  11. Used by                         many
  12. Inherited by                    <none>
  13.  
  14. Declaration                     Graphic graph;
  15.  
  16. Instance Variables
  17.                 int     graphdriver, graphmode;
  18.                 int     screenwidth, screenheight;
  19.                 int     fontwidth, fontheight;
  20.                 int     color, pattern;
  21. Instance Methods
  22.                                 Graphic (int driver = DETECT, int mode = 0);
  23.                                 Graphic();
  24.                                 ~Graphic();
  25.                 void    backcolor (int );
  26.                 void    clear      ( );
  27.                                 void    drawchar  (char );
  28.                                 void    drawstring(int , int , char *);
  29.                                 void    fillarc   (int , int , int , int ,
  30.                                                          int , int );
  31.                                 void    filloval  (int , int , int , int );
  32.                 void    fillpolygon(int , int far *);
  33.                 void    fillrect  (int , int , int , int );
  34.                 void    framearc  (int , int , int , int ,
  35.                              int , int );
  36.                 void    framepolygon(int , int far *);
  37.                 void    framerect (int , int , int , int );
  38.                                 void    frameoval (int , int , int , int );
  39.                 void    line_rel  (int , int );
  40.                                 void    line_to   (int , int );
  41.                                 void    move_rel  (int , int );
  42.                                 void    move_to   (int , int );
  43.                                 void    pencolor  (int );
  44.                 void    penpattern(int );
  45.                                 int     readpixel (int , int );
  46.                                 void    screensize(int *, int *);
  47.                                 void    setpixel  (int , int , int );
  48.                 void    textsize  (int *, int *);
  49.                 void    viewport  (int , int , int , int );
  50.                                 void    shutdown  ();
  51.  
  52. --------------------------------------------------------------------------
  53. GENERAL DESCRIPTION
  54.  
  55. The Graphic Class provides methods for drawing and plotting on the video
  56. screen using the Borland BGI drivers.  This Class simplifies the syntax
  57. of many of the commands and provides a more consistent interface than the
  58. standard BGI interface.  In addition, the Graphic Class can simplify the
  59. job of porting to another dialect of C++ by providing configurable hooks
  60. into the graphics commands.
  61.  
  62. --------------------------------------------------------------------------
  63. VARIABLES
  64.  
  65. int     graphdriver;
  66.         The numeric value of the current BGI driver.
  67.  
  68. int     graphmode;
  69.         The value of the mode of the current driver.
  70.  
  71. int     screenwidth
  72.         Thw width of the screen in pixels.
  73.  
  74. int     screenheight;
  75.         The height of the screen in pixels.
  76.  
  77. int     fontwidth;
  78.     The character width of the selected font.
  79.  
  80. int     fontheight;
  81.     The character height of the current font.
  82.  
  83. int     color;
  84.         The current pen color.
  85.  
  86. int     pattern;
  87.         The current pen and fill pattern.
  88.  
  89. --------------------------------------------------------------------------
  90. METHODS
  91.  
  92. Graphic (int driver = DETECT, int mode = 0);
  93.     Creates and instance of the Graphic Class and initialize the
  94.     BGI driver and display.  Defaults to DETECT.
  95.  
  96. Graphic ();
  97.     Creates and instance of the Graphic Class and initialize the
  98.     BGI driver and display.
  99.  
  100. ~Graphic();
  101.     Closes down the BGI dirver and destroys the instance.
  102.  
  103. void    backcolor (int color);
  104.     Sets the background color used for filling.
  105.  
  106. void    clear      ( );
  107.     Clears the viewport to the background color.
  108.  
  109. void    drawchar  (char c);
  110.     Draws a character in the current color at the current pen position.
  111.  
  112. void    drawstring(int x, int y, char *s);
  113.         Draws a string in the current color at the location x, y.
  114.  
  115. void    fillarc   (int x, int y, int xr, int yr, int beg, int end);
  116.         Draws an arc filled with the current color and pattern.  The
  117.         center is at x,y with a radius of xr,yr from the beg angle to
  118.         the end ang.
  119.  
  120. void    filloval  (int x, int y, int xr, int yr);
  121.     Draws an oval filled with the current color and pattern.  The
  122.     center is at x,y with a radius of xr,yr.
  123.  
  124. void    fillpolygon(int num, int far *pts);
  125.     Fills a Polygon with the current color and pattern.
  126.  
  127. void    fillrect  (int x1, int y1, int x2, int y2);
  128.     Fills a rectangle with the current color and pattern.
  129.  
  130. void    framearc  (int , int , int , int , int , int );
  131.     Frames an arc filled with the current color.  The center is at
  132.     x,y with a radius of xr,yr from the beg angle to the end ang.
  133.  
  134. void    frameoval (int x, int y, int xr, int yr);
  135.     Frames an oval filled with the current color.  The center is at
  136.     x,y with a radius of xr,yr.
  137.  
  138. void    framepolygon(int num, int far *);
  139.     Frames a polygon with the current color.
  140.  
  141. void    framerect (int x1, int y1, int x2, int y2);
  142.     Frames a rectangle in the current color.
  143.  
  144. void    line_rel  (int x, int y);
  145.     Draws a line in the current color by moving relative to the
  146.     current position.
  147.  
  148. void    line_to   (int x, int y);
  149.     Draws a line from the current position the the absolute screen
  150.     coordinate x,y.
  151.  
  152. void    move_rel  (int x, int y);
  153.         Moves the current position relative to the current position,
  154.         but does not draw.
  155.  
  156. void    move_to   (int x, int y);
  157.         Move the current position to the absolute screen coordianate.
  158.  
  159. void    pencolor  (int );
  160.         Sets the current pen color.
  161.  
  162. void    penpattern(int );
  163.         Sets the current pen pattern.
  164.  
  165. int     readpixel (int x, int y);
  166.     Returns with the color of the pixel at x, y.
  167.  
  168. void    screensize(int *xmax, int *ymax);
  169.         Returns with the values of the screens maximum coordinates.
  170.  
  171. void    setpixel  (int x, int y, int c);
  172.         Sets the color of the pixel at x,y to c.
  173.  
  174. void    textsize  (int *w, int *h);
  175.         Returns with the width and height of the active font in pixels.
  176.  
  177. void    viewport  (int x1, int y1, int x2, int y2);
  178.     Sets the viewport used for drawing.  Clips image at the border.
  179.  
  180. void    shutdown  ();
  181.     Closes down the BGI driver.  Called by ~Graphic().
  182.  
  183. --------------------------------------------------------------------------
  184. GRAPHIC.DOC                        Copyright (c) 1991 by James S. Clark
  185. ==========================================================================
  186.